package com.huluobo.a2303mdmdemo.demo

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

/**
 *  Created by LC on 2025/8/15.
 */

@Composable
fun MyBox() {
    Box(
        modifier = Modifier.padding(10.dp),
        //盒子的内容位置
        contentAlignment = Alignment.TopEnd
    ) {
        Text(
            text = "hello", modifier = Modifier
                .background(Color.Yellow, RoundedCornerShape(10.dp))
                .border(
                    1.dp, Color.Blue,
                    RoundedCornerShape(10.dp)
                )
                .padding(10.dp)
        )
//        Text(
//            text = "2",
//            color = Color.White,
//            textAlign = TextAlign.Center,
//            fontSize = 9.sp,
//            modifier = Modifier
//                .size(16.dp)
//                .offset(3.dp, (-3).dp)
//                .background(
//                    Color.Red,
//                    CircleShape
//                )
//                .padding(3.dp)
//        )

        Icon(
            imageVector = Icons.Default.Close, contentDescription = "", modifier = Modifier
                .size(16.dp)
                .offset(3.dp, (-3).dp)
                .background(
                    Color.Red,
                    CircleShape
                ),
            tint = Color.White
        )
    }
}